<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">



    <h:head>

    </h:head>

    <h:body>
        <ui:composition template="/resources/template/template.xhtml">
            <ui:define name="content">

                <h:panelGroup >
                    <h:form  >
                        <p:growl />
                        <p:panel header="Search and Edit Families" >
                            
                                <h:panelGrid columns="3" >
                                    <p:outputLabel value="Membership Card No / Phone No of CHH" ></p:outputLabel>
                                    <p:inputText value="#{patientController.searchText}" autocomplete="off"></p:inputText>
                                    <p:commandButton ajax="false" action="#{patientController.searchFamily()}" value="Search" >
                                    </p:commandButton>
                                </h:panelGrid>
                            
                            
                        </p:panel>
                        

                            <p:dataTable value="#{patientController.families}" var="f" rowIndexVar="n" rowKey="#{f.id}" >
                                <p:column headerText="Membership No" >
                                    <p:outputLabel value="#{f.membershipCardNo}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Phone No" >
                                    <p:outputLabel value="#{f.phoneNo}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Actions" >
                                    <p:commandButton ajax="false" value="Edit" action="add_family" >
                                        <f:setPropertyActionListener value="#{f}" target="#{patientController.currentFamily}" ></f:setPropertyActionListener>
                                    </p:commandButton>
                                </p:column>
                            </p:dataTable>

                        

                    </h:form>
                </h:panelGroup>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
